<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>7.系统构造函数的原型体现</title>
</head>

<body>
  <img src="https://doc.houdunren.com/assets/img/image-20191010023843179.58edd59f.png" alt="img">
  <script>

    //- 构造函数拥有原型
    //- 创建对象时构造函数把原型赋予对象
    function User () { }
    let xj = new User();
    console.log(xj.__proto__ == User.prototype);// true
    Array.prototype.show = function () {
      console.log('houdunren');
    };

    // 也就是 ，对象的 __proto__ == 其构造函数的 prototype 属性中 保存的原型对象
    let arr = []; // new Array
    console.log(arr.__proto__ == Array.prototype); // true
    arr.show(); //houdunren

    let str = "";// new String
    console.log(str.__proto__ == String.prototype); // true;

    let bool = true; // new Boolean
    console.log(bool.__proto__ == Boolean.prototype); // true;

    let reg = /a/i; // new RegExp
    console.log(reg.__proto__ == RegExp.prototype); // true;
  </script>
</body>

</html>